/*River Warren
 *September 7, 2011
 *
 *test.cpp
 *stub for testing Room class
*/

#include "Room.h"
#include "base.h"
#include "Castle.h"
#include <string>

using namespace std;

int main()
{
    string str;
    int choice, direction;
    try{
        Castle *r = new Castle();
        cout << r->getDesc() << endl;
        do
        {
            cout << "Choose:\n1)Move\n2)Unlock\n3)Get Key code\n4)exit" << endl;
            cin >> choice;
            switch(choice)
            {
                case 1:
                    cout << "Enter a Direction:\n1)North\n2)East\n3)South\n4)West" << endl;
                    cin >> direction;
                    try
                    {
                        r->move(direction);
                        cout << endl << r->getDesc() << endl;
                    }
                    catch(string msg){cout << msg << endl;}
                    cout << endl;
                    break;
                case 2:
                    cout << "Enter key ";
                    cin >> str;
                    try
                    {
                        if(!r->unlockDoor(str))cout << "That key does not work" << endl;
                        else cout << "You have succesfuly unlocked the door" << endl;
                    }
                    catch(string msg){cout << msg << endl;}
                case 3:
                    str = r->getKeyCode();
                    if(str.compare("") == 0) cout << "There is no door to unlock here." << endl;
                    else cout << "Key code: " << str << endl;

            }
            //
        }while (choice != 4);
        r->saveRooms();
    }

    catch(string msg){cout << msg<< endl;}
    return 0;
}

